#define _CRT_SECURE_NO_WARNINGS 1
#include<vector>
// Definition for Employee.
class Employee {
public:
    int id;
    int importance;
    std::vector<int> subordinates;
};


class Solution {
public:
    int DFS(std::vector<Employee*> employees, int id)
    {
        Employee* curE = nullptr;
        for (auto e : employees)
        {
            if (e->id == id)
            {
                curE = e;
                break;
            }
        }
        int sum = curE->importance;
        for (auto subId : curE->subordinates)
        {
            sum += DFS(employees, subId);
        }
        return sum;
    }
    int getImportance(std::vector<Employee*> employees, int id)
    {
        if (employees.empty())
        {
            return 0;
        }
        return DFS(employees, id);
    }
};